# -*- encoding: utf-8 -*-

import redis


class RedisHelper:
    def __init__(self):
        self.__conn = redis.ConnectionPool(host='10.26.249.49', port=6379, password='Xjiye2016!@#', db=10)
        # self.__conn = redis.ConnectionPool(host='120.55.90.223', port=51000,password='xjiye2016!@#++9')
        self.r = redis.Redis(connection_pool=self.__conn)

    def get__all__map(self, key):
        return self.r.hgetall(key)

    def get__key__map(self, r_key, m_key):
        return self.r.hget(r_key, m_key)

    def get__keys(self, r_key):
        return self.r.hkeys(r_key)

    def get__list(self, r_key):
        return self.r.lrange(r_key, 0, 1)

    def blpop(self, r_key):
        return self.r.blpop(r_key, timeout=4)
